Overview


R is a software environment for statistical computing and graphics. Amongst other things it include

  • an effective data handling and storage facility
  • a suite of operators for calculations on arrays, in particular matrices
  • a large, coherent, integrated collection of intermediate tools for data analysis
  • graphical facilities for data analysis and display either on-screen or on hardcopy, and
  • a well-developed, simple and effective programming language.

Installing R



Installing packages in R


This example shows how to quickly install a package (in this case a genetic algorithm) that is downloaded from the CRAN repository on the R website.
R installs all packages to a local installation directory, which is specified by the user the first time that a package is installed.

  • Download the package containing the genetic algorithm:
    • Open http://www.r-project.org/
    • Click on "CRAN"
    • Choose the closest mirror-site (e.g. Germany/Berlin)
    • Click on "Contributed extension packages"
    • Click on selected package (try "genalg")
    • Click on the link next to package source ("genalg_0.1.1.tar.gz") and save on your computer.
  • Install the package (at the shell prompt):
    • R CMD INSTALL genalg_0.1.1.tar.gz
  • Use the package in R:
    • library(genalg) # this command loads the genalg package.
    • help(rbga) # get help on a specific command in the "genalg" package.
  • Run a demo
    • Copy and paste the first example given in "help(rbga)"

The "genalg" package is a bit unusual in that there is no help file for "genalg" (e.g. help(genalg) doesn't work). For this reason, you may also want to download the manual from the R website (on the same page as genalg_0.1.1.tar.gz)

A very useful R package that is not available on the R website is Bio3D. The package was written by Barry Grant, who is a postdoc in Andrew McCammon's group. It allows reading and writing of PDB files and molecular dynamics trajectories amongst other useful features.

Packages can also be installed from within R. At the R prompt, try "help(install.packages)" for more information (read the "See Also" section).

Some other useful packages:
  • xtable # write latex and html tables from R


Example R scripts


Please see:
  • /net/v215-2/data4/fedorov-group/R/